Skip to content

PLEX-3129 LP skip blocks#501

Merged
dhaidashenko merged 13 commits into
developfrom
feature/PLEX-3129-lp-skip-blocks
Jul 15, 2026
Merged

PLEX-3129 LP skip blocks#501
dhaidashenko merged 13 commits into
developfrom
feature/PLEX-3129-lp-skip-blocks

Conversation

@dhaidashenko

@dhaidashenko dhaidashenko commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Expose the API to force LP to fast-forward to a new finalized checkpoint.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-evm

⚠️ Breaking Changes (3)

pkg/logpoller.Client (1)
  • HeaderByNumberWithOpts — ➕ Added
pkg/logpoller.LogPoller (1)
  • SkipToBlock — ➕ Added
pkg/logpoller.ORM (1)
  • StoreNewFinalizedCheckpoint — ➕ Added

✅ Compatible Changes (7)

pkg/logpoller.(*DSORM) (1)
  • StoreNewFinalizedCheckpoint — ➕ Added
pkg/logpoller.(*ObservedORM) (1)
  • StoreNewFinalizedCheckpoint — ➕ Added
pkg/logpoller.(*logPoller) (1)
  • SkipToBlock — ➕ Added
pkg/logpoller/mocks (1)
  • LogPoller_SkipToBlock_Call — ➕ Added
pkg/logpoller/mocks.(*LogPoller) (1)
  • SkipToBlock — ➕ Added
pkg/logpoller/mocks.(*LogPoller_Expecter) (1)
  • SkipToBlock — ➕ Added
pkg/relay.(*evmService) (1)
  • LPSkipToBlock — ➕ Added

📄 View full apidiff report

@dhaidashenko
dhaidashenko force-pushed the feature/PLEX-3129-lp-skip-blocks branch from 2af46d9 to 8b39b14 Compare July 13, 2026 18:23
@dhaidashenko
dhaidashenko marked this pull request as ready for review July 13, 2026 18:48
@dhaidashenko
dhaidashenko requested review from a team as code owners July 13, 2026 18:48
Copilot AI review requested due to automatic review settings July 13, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an operator/API mechanism to fast-forward the EVM LogPoller to a new finalized checkpoint (“skip blocks”), including DB-side pruning and the necessary concurrency/atomicity safeguards.

Changes:

  • Exposes a relayer-level method to request a LogPoller fast-forward to a target block.
  • Adds LogPoller SkipToBlock plus a new ORM transactional method to prune logs/blocks and store a new finalized checkpoint anchor.
  • Adds/updates tests and mocks to cover checkpoint storage, transactional behavior, and SkipToBlock edge cases.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/relay/evm_service.go Adds LPSkipToBlock API surface that delegates to the chain LogPoller.
pkg/logpoller/orm.go Introduces StoreNewFinalizedCheckpoint and refactors delete/insert helpers for transactional reuse.
pkg/logpoller/orm_test.go Adds coverage for checkpoint storage semantics and verifies transactional DS usage.
pkg/logpoller/observability.go Wires StoreNewFinalizedCheckpoint through the observed ORM wrapper for metrics/tracing.
pkg/logpoller/mocks/log_poller.go Extends the LogPoller mock with SkipToBlock.
pkg/logpoller/mock_orm_test.go Extends the ORM mock with StoreNewFinalizedCheckpoint.
pkg/logpoller/log_poller.go Implements SkipToBlock, adds runMu coordination, and refactors main loop tick handlers.
pkg/logpoller/log_poller_internal_test.go Adds unit tests for SkipToBlock behavior and error handling.
pkg/logpoller/disabled.go Implements SkipToBlock on the disabled LogPoller to return ErrDisabled.
Files not reviewed (2)
  • pkg/logpoller/mock_orm_test.go: Generated file
  • pkg/logpoller/mocks/log_poller.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/logpoller/log_poller.go
Comment thread pkg/logpoller/orm.go
@dhaidashenko
dhaidashenko force-pushed the feature/PLEX-3129-lp-skip-blocks branch from a8e4588 to 6207437 Compare July 14, 2026 16:51
Comment thread pkg/logpoller/log_poller_internal_test.go Outdated
Comment thread pkg/logpoller/orm_test.go Outdated
amit-momin
amit-momin previously approved these changes Jul 14, 2026
Comment thread pkg/logpoller/log_poller.go Outdated
Comment on lines +1983 to +1988
err = validateHead((*evmtypes.Head)(anchorHead))
if err != nil {
return fmt.Errorf("failed to validate anchor block %d: %w", anchorBlockNumber, err)
}

anchorBlock := finalizedHeadToBlock((*evmtypes.Head)(anchorHead))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, this is getting casted twice, I'd just convert it first and change validateHead to validate the block struct that finalizedHeadToBlock returns

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the type that validate Head accepts requires changes in all other places that use it, which creates a ripple effect.
Fixed double cast by introduction of new method

}

minBlockToPrune := anchorBlockNumber
if latest != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't an error be returned if latest finalized block can't be confirmed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the latest block is missing, it just means the DB is empty.
It can occur only if the main run has not ticked yet, which is unlikely. But even if it occurs, we'll save the finalized block as a checkpoint. Thus, the LP state will be valid.

amit-momin
amit-momin previously approved these changes Jul 15, 2026
ilija42
ilija42 previously approved these changes Jul 15, 2026
@dhaidashenko
dhaidashenko enabled auto-merge (squash) July 15, 2026 15:58
@dhaidashenko
dhaidashenko merged commit 611d8ac into develop Jul 15, 2026
35 of 37 checks passed
@dhaidashenko
dhaidashenko deleted the feature/PLEX-3129-lp-skip-blocks branch July 15, 2026 16:10
@dhaidashenko
dhaidashenko restored the feature/PLEX-3129-lp-skip-blocks branch July 15, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants